package proxy;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
/**
 * @Author: linKe
 * @Date: 2022/1/15 14:41
 * @FileName: Client
 * @version: 1.0
 * @Description: 客户端    测试类
 * 静态代理模式
 */
public class Client extends JFrame {

    private static final long serialVersionUID = -2370977751135677355L;
    private JPanel contentPane;
    /**
     * 图片代理
     */
    private ImageIconProxy proxy;

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    Client frame = new Client();
                    // 根据参数b的值显示或隐藏此Window 。
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public Client() {
        //windows样式
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
            e.printStackTrace();
        }
        setResizable(false);
        setTitle("\u4EE3\u7406\u6A21\u5F0F");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 1000, 800);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);

        proxy = new ImageIconProxy("http://i3.hoopchina.com.cn/blogfile/201207/19/134270981041559.jpg");
        contentPane.add(new ImageComponent(proxy));


    }
}




